package com.raigor.system.service.impl;

import java.util.List;
import com.raigor.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.raigor.system.mapper.SysUserApikeyMapper;
import com.raigor.system.domain.SysUserApikey;
import com.raigor.system.service.ISysUserApikeyService;

/**
 * 用户apikeyService业务层处理
 * 
 * @author libaolu
 * @date 2021-12-31
 */
@Service
public class SysUserApikeyServiceImpl implements ISysUserApikeyService 
{
    @Autowired
    private SysUserApikeyMapper sysUserApikeyMapper;

    /**
     * 查询用户apikey
     * 
     * @param userId 用户id
     * @return 用户apikey
     */

    @Override
    public SysUserApikey selectSysUserApikeyByUserId(Long userId)
    {
        return sysUserApikeyMapper.selectSysUserApikeyByUserId(userId);
    }

    /**
     * 查询用户apikey列表
     * 
     * @param sysUserApikey 用户apikey
     * @return 用户apikey
     */
    @Override
    public List<SysUserApikey> selectSysUserApikeyList(SysUserApikey sysUserApikey)
    {
        return sysUserApikeyMapper.selectSysUserApikeyList(sysUserApikey);
    }

    /**
     * 新增用户apikey
     * 
     * @param sysUserApikey 用户apikey
     * @return 结果
     */
    @Override
    public int insertSysUserApikey(SysUserApikey sysUserApikey)
    {
        sysUserApikey.setCreateTime(DateUtils.getNowDate());
        return sysUserApikeyMapper.insertSysUserApikey(sysUserApikey);
    }

    /**
     * 修改用户apikey
     * 
     * @param sysUserApikey 用户apikey
     * @return 结果
     */
    @Override
    public int updateSysUserApikey(SysUserApikey sysUserApikey)
    {
        sysUserApikey.setUpdateTime(DateUtils.getNowDate());
        return sysUserApikeyMapper.updateSysUserApikey(sysUserApikey);
    }

    /**
     * 批量删除用户apikey
     * 
     * @param apiKeys 需要删除的用户apikey主键
     * @return 结果
     */
    @Override
    public int deleteSysUserApikeyByApiKeys(String[] apiKeys)
    {
        return sysUserApikeyMapper.deleteSysUserApikeyByApiKeys(apiKeys);
    }

    /**
     * 删除用户apikey信息
     * 
     * @param apiKey 用户apikey主键
     * @return 结果
     */
    @Override
    public int deleteSysUserApikeyByApiKey(String apiKey)
    {
        return sysUserApikeyMapper.deleteSysUserApikeyByApiKey(apiKey);
    }
}
